package com.zhang.sh.controller;

import com.zhang.sh.pojo.Order;
import com.zhang.sh.pojo.Result;
import com.zhang.sh.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class OrderController {
    @Autowired
    OrderService orderService;

    @GetMapping("order/{username}")
    public Result getOrderList(@PathVariable("username") String username){
        List<Order> orders = orderService.getOrder(username);
        System.out.println(orders);
        return new Result(orders);
    }


}
